//
//  PTTopStatusViewController.m
//  PuTie
//
//  Created by 周宏全 on 2017/7/14.
//  Copyright © 2017年 周宏全. All rights reserved.
//

#import "PTTopStatusViewController.h"
#import "UIColor+HMAddition.h"
#import "Masonry.h"

@interface PTTopStatusViewController ()

@end

@implementation PTTopStatusViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 调用添加状态视图的方法
    [self addStatusView];
    
    // 设置状态视图的背景色
    self.view.backgroundColor = [UIColor hm_colorWithHex:0xD6D6D6];
    
}


#pragma mark - 添加状态视图
- (void) addStatusView {
    
    // 创建左边 选择标签 Button
    UIButton *leftBtn = [[UIButton alloc] init];
    [leftBtn setTitle: @"选择标签" forState: UIControlStateNormal];
    leftBtn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
    [leftBtn setBackgroundColor: [UIColor hm_colorWithHex:0x1965DA]];
    [self.view addSubview:leftBtn];

    
    // 创建中间 隔板 View
    UIView *sView = [[UIView alloc] init];
    sView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:sView];

    
    // 创建右边 状态 View
    UIView *rightView = [[UIView alloc] init];
    rightView.backgroundColor = [UIColor hm_colorWithHex:0x1965DA];
    [self.view addSubview:rightView];
    
        // 创建连接打印机状态的小label
        UILabel *printLabel = [[UILabel alloc] init];
        printLabel.text = @"未连接打印机";
        printLabel.textColor = [UIColor whiteColor];
        printLabel.font = [UIFont systemFontOfSize:14.0];
        [rightView addSubview:printLabel];
        // “连接打印机”Label在右边视图的约束
        [printLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(rightView.mas_centerY);
            make.right.equalTo(rightView.mas_right).offset(-10);
        }];
    
    
    // 设置整体约束
    // 中间分隔小白条的约束
    [sView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view.mas_top).offset(2);
        make.bottom.equalTo(self.view.mas_bottom).offset(-2);
        make.width.equalTo(@2);
        make.centerX.equalTo(self.view.mas_centerX);
    }];
    
    // 左边按钮的约束
    [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.equalTo(self.view);
        make.right.equalTo(sView.mas_left);
    }];
    
    // 右边视图的约束
    [rightView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(sView.mas_right);
        make.right.equalTo(self.view);
        make.top.bottom.equalTo(self.view);
    }];
    
    
}




@end
